import { queryTagList } from "@/api/tag.api";
import { Tag } from "@/types/tag";
import { onMounted, reactive } from "vue";
interface TagData {
  list: Array<Tag>;
  current: Tag | null;
}
export const useTagList = (): {
  tagList: TagData;
} => {
  const tagList = reactive<TagData>({
    list: [],
    current: null,
  });
  const getTagList = async () => {
    const res = await queryTagList();
    if (res.code === 200) {
      tagList.list = res.data || [];
    }
  };
  onMounted(() => {
    getTagList();
  });
  return {
    tagList,
  };
};
